import 'dart:io';

import 'package:animal/constant/color.dart';
import 'package:animal/constant/font.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:flutter/cupertino.dart';

class DialogWidget {
  ///带有标题文本的dialog
  static Widget titleDialog({
    final String? title,
    final String? content,
    final void Function()? onTap,
    final Color? readColor,
    final Color? noReadColor,
  }) {
    return Container(
      padding: EdgeInsets.fromLTRB(ScreenUtil().L(16), ScreenUtil().L(25), ScreenUtil().L(16), ScreenUtil().L(5)),
      margin: EdgeInsets.symmetric(horizontal: ScreenUtil().L(33.5), vertical: ScreenUtil().L(100)),
      decoration: BoxDecoration(color: const Color(0XFFFFFFFF), borderRadius: BorderRadius.circular(ScreenUtil().L(10))),
      child: Stack(
        alignment: Alignment.topCenter,
        children: [
          Text(title ?? "", style: KFontConstant.myTextStyle(size: 16, bold: true)),
          Container(
            margin: EdgeInsets.only(top: ScreenUtil().L(30),bottom: ScreenUtil().L(130)),
            child: SingleChildScrollView(
              physics: const BouncingScrollPhysics(),
                child: Text(content ?? "", style: KFontConstant.myTextStyle(size: 14, height: ScreenUtil().L(1.5)))),
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              CupertinoButton(
              onPressed: onTap,
              child: Text(
                "同意",
                style: KFontConstant.myTextStyle(
                  size: 14,
                  color: KColorConstant.black222,
                ),
              ),
              padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(38)),
              color: readColor ?? KColorConstant.btnColor3C5A99,
              borderRadius: BorderRadius.circular(ScreenUtil().L(5)),
            ),
              Container(
                height: ScreenUtil().L(15),
              ),
              CupertinoButton(
                onPressed: () => exit(0),
                child: Text(
                  "不同意",
                  style: KFontConstant.myTextStyle(
                    size: 14,
                    color: KColorConstant.black222,
                  ),
                ),
                padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(30)),
                color: noReadColor ?? KColorConstant.btnColor3C5A99,
                borderRadius: BorderRadius.circular(ScreenUtil().L(5)),
              ),
              Container(height: ScreenUtil().L(20))],
          )

        ],
      ),
    );
  }
}
